#!/bin/bash

REPO_ROOT="/remote/iosg/home/bot-hft/jenkins/workspace/coin2_feed_plot/coin"
cd "${REPO_ROOT}"

if [ -n "${1}" ]; then
  TRADING_DATE="${1}"
else
  TRADING_DATE="$(TZ=Asia/Shanghai date '+%Y%m%d')"
fi

START_DATE="${TRADING_DATE}"
END_DATE="$(date --date=@$(( $(date +%s --date=${START_DATE}) + 86400 )) '+%Y%m%d')"

echo "START_DATE=${START_DATE}"
echo "END_DATE=${END_DATE}"

source /remote/iosg/home/bot-hft/miniconda3/etc/profile.d/conda.sh
conda activate /remote/iosg/home/bot-hft/miniconda3/envs/coin2_motion_env_migration
cd python
./pyrunner coin/support/feed_tool/feed_plot_slurm/feed_archive_checker_slurm.py \
  --enabled_groups="okex_futures,okex_spot,okex_futures_swap,huobi_futures,huobi_spot,huobi_futures_swap,bitmex,binance_spot,binanceus_spot,binance_futures,gdax,kraken,upbit,coinone,quoinex,bithumb,bitflyer,bitbank,bybit,bybit_futures,bybit-linear,ftx,ftx_futures,bitstamp_spot,huobi_futures_linear_swap,korbit_spot,bitbank_spot,prex_futures,lmaxdigital_spot,gopax,deribit_futures,deribit_options,coincheck_spot,uniswap_spot,uniswapv2_spot,gateio_spot,gateio_futures,phemex_spot,phemex_futures,kucoin_spot,kucoin_futures,dydx_futures,pancakeswap_spot,btcturk_spot,mexc_spot,mexc_futures,crypto_spot,crypto_futures,bitget_spot,bitget_futures,apollox_futures,mercado_spot,bit_spot,maicoin_spot,uniswapv3_arbitrum_spot" \
  --start_date=${START_DATE} \
  --end_date=${END_DATE} \
  --script_only=False \
  --sbatch_args="--wait -N6 -n128 --mem-per-cpu=4G --job-name=coin2plot"

conda deactivate
